package fr.utbm.tx52.stamp.ui.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import fr.utbm.tx52.stamp.R;
import fr.utbm.tx52.stamp.adapter.ImageAdapter;
import fr.utbm.tx52.stamp.logic.algorithm.SortAlgorithms;

/**
 * Fragment used for the right tab in medium mode and the only main tab in low
 * mode Display a grid of photos.
 *
 * @author GREA Antoine
 * @author TISSERAND Geoffrey
 */
public class Gallery extends Fragment
{

	public ImageAdapter imageAdapter;
	public static Gallery instance;
	public static SortAlgorithms sort;

	public enum SortType
	{

		BY_DATE,
		BY_CITY
	}

	public enum SortOrder
	{

		ASC,
		DESC
	}
	public static SortType sortType = SortType.BY_DATE;
	public static SortOrder sortOrder = SortOrder.ASC;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState)
	{
		// Inflate the layout for this fragment
		instance = this;
		GridView gridView = (GridView) inflater.inflate(R.layout.gallery, container, false);
		imageAdapter = new ImageAdapter(getActivity(), ImageAdapter.Listener.LAUNCH);
		gridView.setAdapter(imageAdapter);
		sort = new SortAlgorithms(imageAdapter.getFiles());
		return gridView;
	}
}
